Image processing device and image processing method

ABSTRACT

An image processing device includes: a calculator that calculates a gray scale histogram for each color component of an image signal; a calculator that calculates, for each color component, a maximum and a minimum of classes having a frequency greater than zero in the gray scale histogram; a determiner that generates, for each color component, a histogram having classes each having an absolute difference value between the frequencies of adjacent classes in the gray scale histogram, and compares the absolute difference values in the histograms with a value to determine, from the presence or absence of an absolute difference value exceeding the value, an image type of the image; a generator that generates a gray scale correction curve from the calculated maximum and minimum for each color component; and a corrector that performs gray scale correction on the image signal using the gray scale correction curve.

TECHNICAL FIELD

The present invention relates to an image processing device and an imageprocessing method capable of controlling the gray scale of an image.

BACKGROUND ART

In order to enhance the gray scale of an image, the gray scale iscorrected by calculating, with respect to plural image signalscorresponding to respective pixels constituting the image, a maximum anda minimum of gray levels for each color component, and setting themaximum and minimum calculated for each color component as the maximumand minimum of the dynamic range of the gray scale for each colorcomponent in the image signal system of the corrected image (see, forexample, Patent Documents 1 and 2).

PRIOR ART DOCUMENTS Patent Documents

Patent Document 1: Japanese Patent Application Publication No.2006-128986 (page 6, FIGS. 1 and 9)

Patent Document 2: Japanese Patent No. 4447035 (page 5, FIGS. 4 and 5)

SUMMARY OF THE INVENTION Problems to be Solved by the Invention

However, there is a problem that when conventional gray scale correctionis uniformly performed on images with different characteristics, changein color or loss of gradation occurs. For example, there is a problemthat when conventional gray scale correction is performed on an image(such as a illustration) whose gray levels of the image signalconcentrate in one part, unnecessary change in color or brightnessoccurs in a part originally represented by a uniform color.

The present invention has been made to solve the above-mentionedproblems, and an object thereof is to provide an image processing devicecapable of determining a type of an image and performing gray scalecorrection according to the type of the image.

Means for Solving the Problems

An image processing device according to the present invention includes:a gray scale histogram calculator that calculates, with respect to animage signal having color components and gray scale components andforming an image, a gray scale histogram of the gray scale componentsfor each color component; a maximum/minimum calculator that uses thegray scale histogram for each color component to calculate, for eachcolor component, a maximum and a minimum of classes having a frequencygreater than zero; an image type determiner that generates, fromadjacent classes and frequencies in the gray scale histogram generatedfor each color component, an absolute difference value histogram foreach color component, compares absolute difference values in theabsolute difference value histograms with a predetermined thresholdvalue to determine, according to the presence or absence of an absolutedifference value exceeding the threshold value, a size of an area ofimage regions where the gray scale components are uniform, anddetermines an image type of the image according to the determination; agray scale correction curve generator that generates a gray scalecorrection curve for correcting a gray scale of the image signal foreach color component so that the largest and the smallest of the maximumand the minimum of the classes for each color component calculated bythe maximum/minimum calculator are set as the maximum and the minimum ofthe gray scale correction curve; and a gray scale corrector that usesthe gray scale correction curve to perform gray scale correction on thegray scale components of the image signal for each color component.

Effect of the Invention

Since the present invention determines an image type and generates agray scale correction curve using the image type, it can perform grayscale correction according to the image type.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 is a block diagram of an image processing device according to afirst embodiment of the present invention.

FIGS. 2(a) and 2(b) show an example of a gray scale histogram accordingto the first embodiment of the present invention.

FIGS. 3(a) and 3(b) each show an example of a histogram of absolutedifference values of frequencies of adjacent classes in a gray scalehistogram according to the first embodiment of the present invention.

FIGS. 4(a) to 4(c) each show an example of the histogram of absolutedifference values of frequencies of adjacent classes in a gray scalehistogram according to the first embodiment of the present invention.

FIG. 5 is an example of the gray scale histogram according to the firstembodiment of the present invention.

FIG. 6 is an example of a gray scale correction curve according to thefirst embodiment of the present invention.

FIGS. 7(a) to 7(c) show an example of an image processed by the imageprocessing device according to the first embodiment of the presentinvention.

FIG. 8 is an example of a gray scale correction curve according to asecond embodiment of the present invention.

FIG. 9 is an example of the gray scale correction curve according to thesecond embodiment of the present invention.

FIGS. 10(a) and 10(b) are drawings for explaining the operation of amaximum/minimum calculator 3 according to a fourth embodiment of thepresent invention.

MODES FOR CARRYING OUT THE INVENTION First Embodiment

FIG. 1 is a block diagram showing the configuration of an imageprocessing device according to the first embodiment for implementing thepresent invention. The image processing device according to thisembodiment includes a gray scale histogram calculator 1, an image typedeterminer 2, a maximum/minimum calculator 3, a gray scale correctioncurve generator 4, and a gray scale corrector 5.

First, the configuration will be described. The gray scale histogramcalculator 1 receives an input image signal, calculates a gray scalehistogram of gray scale components for each color component of the inputimage signal, and outputs the gray scale histogram for each colorcomponent to the image type determiner 2 and maximum/minimum calculator3.

The input image signal is an image signal forming an image, and includesthe color components and the gray scale components.

The image type determiner 2 uses the gray scale histogram for each colorcomponent input from the gray scale histogram calculator 1 to calculate,for each color component, a ratio of the area of image regions where thegray scale components are uniform, determines the image type of theimage on the basis of the ratios of the areas of the image regions wherethe gray scale components are uniform, and outputs the determinationresult to the gray scale correction curve generator 4.

The maximum/minimum calculator 3 uses the gray scale histogram for eachcolor component input from the gray scale histogram calculator 1 tocalculate, for each color component, a maximum and a minimum of the grayscale histogram, and outputs the maximum and minimum for each colorcomponent to the gray scale correction curve generator 4.

The gray scale correction curve generator 4 generates a gray scalecorrection curve on the basis of the determination result input from theimage type determiner 2 and the maximum and minimum for each colorcomponent input from the maximum/minimum calculator 3 and outputs thegray scale correction curve to the gray scale corrector 5.

The gray scale corrector 5 uses the input image signal and the grayscale correction curve input from the gray scale correction curvegenerator 4 to convert the gray scale of the input image signal, andoutputs the image signal after the conversion.

Next, the operation will be described. The input image signal is inputto the gray scale histogram calculator 1 and gray scale corrector 5. Thegray scale histogram calculator 1 generates a gray scale histogram ofthe gray scale components for each color component of the input imagesignal. The gray scale histogram is a histogram having gray levels asclasses and the number of pixels or the proportion of pixels to thetotal number of pixels in the input image as frequency. Since the grayscale histogram is generated for each color component, the gray scalehistogram calculator 1 calculates the same number of gray scalehistograms as the color components.

An example of the gray scale histogram will be described, assuming thatthe color components of the input image signal consist of R, G, and B,and the gray scale components have 256 gray levels ranging from 0 to255. FIG. 2(a) shows a gray scale histogram with the classes on thehorizontal axis and the proportion (frequency) of pixels to the totalnumber of pixels in the input image on the vertical axis. FIG. 2(a)shows an example of the gray scale histogram of the R component. In FIG.2(a), the interval on the horizontal axis, that is, the class intervalis identical to the gray level interval, which is 1. The class intervalmay be set to a value other than 1, such as 2, 4, 8, or 16. As the classinterval becomes closer to 1, the gray scale correction becomes morefaithful to the input image. However, as the class interval becomessmaller, the memory required to store the gray scale histogram becomeslarger. The following description assumes that the class interval isidentical to the gray level interval and is 1, i.e., that the classes onthe horizontal axis in the gray scale histogram are identical to thegray levels.

The gray scale histograms of the respective color components, i.e., thegray scale histogram of the R component, the gray scale histogram of theG component, and the gray scale histogram of the B component are outputfrom the gray scale histogram calculator 1 to the image type determiner2 and maximum/minimum calculator 3.

The image type determiner 2 uses the input gray scale histogram for eachcolor component to calculate, for each color component, a ratio of thearea of image regions where the gray scale components are uniform. FIG.2(b) shows a histogram of the absolute values of the differences betweenthe frequencies of adjacent classes in the gray scale histogram of the Rcomponent in FIG. 2(a). In FIG. 2(b), the horizontal axis represents theclasses (gray levels) and the vertical axis represents the absolutedifference value (%). The absolute difference values of the input imageare calculated, the total number of the calculated absolute differencevalues being less by one than the number of the gray levels. In FIG.2(b), since the class interval on the horizontal axis is identical tothe gray level interval, which is 1, the total number of the absolutedifference values of the input image is 255. The image type determiner 2also calculates, for each of the gray scale histograms for the G and Bcomponents, a histogram of the absolute difference values between thefrequencies of adjacent classes in the gray scale histogram, in the samemanner as for the gray scale histogram for the R component.

FIGS. 3(a) and 3(b) show the histograms of the absolute differencevalues between the frequencies of adjacent classes in gray scalehistograms of the R component. FIG. 3(a) shows an example of theabsolute difference values of an image in which ‘the area of regions ofuniform color’ is small; FIG. 3(b) shows an example of the absolutedifference values of an image in which ‘the area of regions of uniformcolor’ is large. Here, for each color component, ‘the area of regions ofuniform color’ corresponds to the area of image regions where the grayscale components are uniform.

As shown in FIGS. 3(a) and 3(b), the absolute difference values of animage in which the area of regions of uniform color is large has acharacteristic that the maximum of the absolute difference values isextremely greater than the maximum of the absolute difference values ofan image in which the area of regions of uniform color is small.Further, the absolute difference values of an image in which the area ofregions of uniform color is large has a characteristic that the numberof gray levels having an absolute difference value of 0 is greater thanthat of an image in which the area of regions of uniform color is small.That is, an image in which the area of regions of uniform color is largehas a characteristic that it has a smaller number of colors than animage in which the area of regions of uniform color is small.

By using the absolute difference values of the gray scale histogram foreach of the color components of R, G, and B, it is possible to determinewhether the input image is an image in which the area of regions ofuniform color is large. For example, in FIGS. 3(a) and 3(b), it will beassumed that a threshold value for the absolute difference values of thegray scale histogram is 20%. The image type determiner 2 compares theabsolute difference values of the gray scale histogram for each of thecolor components of R, G, and B with the threshold value, and if thereis an absolute difference value exceeding the threshold value,determines that the input image is an image in which the area of regionsof uniform color is large.

The reason why whether the input image is an image in which the area ofregions of uniform color is large is determined when gray scalecorrection is performed will now be described. The types of the inputimage include an image obtained by photographing an object by anelectronic device such as a digital camera, and an image, such as apainting, a CG, or an illustration, obtained by designing colors andshapes by hand. Since the latter is painted to have color brightnessintended by a creator, it has the following problems. If its brightnessis changed due to gray scale correction or the like, it becomes an imageagainst the intention of the creator, or if an object depicted on theimage has a memory color of people, it changes to an image against thememory color. For example, gray scale correction may cause the followingproblems: an illustration that appears to have been drawn with a pencilbecomes an illustration that appears to have been drawn with a ballpointpen; a water painting becomes an oil painting; and an image of a grayanimal becomes an image of a white animal.

Thus, when gray scale correction is performed, it is necessary todetermine whether it is an image in which defects may occur due to grayscale correction. Images in which defects may occur due to gray scalecorrection have a common characteristic that they include a solid area(area filled with a single color). Thus, in this embodiment, it isnecessary to determine whether it is an image including a solid area,i.e., whether it is an image in which the area of regions of uniformcolor is large, and if it is an image in which the area of regions ofuniform color is large, control the gray scale correction not to beperformed.

FIGS. 4(a) to 4(c) show an example of the absolute difference values ofthe gray scale histograms of an image, such as a scenery image, in whichthe area of regions of uniform color is small, unlike an illustration orthe like. FIG. 4(a) shows the absolute difference values of the grayscale histogram for the R component; FIG. 4(b) shows the absolutedifference values of the gray scale histogram for the G component; FIG.4(c) shows the absolute difference values of the gray scale histogramfor the B component. As shown at the minimum gray level in FIG. 4(c),even in an image in which the area of regions of uniform color is small,an absolute difference value of the gray scale histogram for aparticular color component may be extremely large. Such an extremelylarge absolute difference value of the gray scale histogram may occur atthe maximum gray level or minimum gray level, in the absolute differencevalues of the gray scale histogram for each color component.

As such, in an image that seems an image, such as a scenery image, inwhich the area of regions of uniform color is small, the absolutedifference value of the gray scale histogram at the maximum class(maximum gray level) or minimum class (minimum gray level) may beextremely large. Such a phenomenon may occur in an image containing alot of blue portions of the sky, green portions of plants, blocked upshadows or blown out highlights due to backlight, or the like.

Thus, the image type determiner 2 compares, for each color component,the absolute difference values of the gray scale histogram within arange excluding the maximum class and minimum class with a predeterminedthreshold value, and if there is a gray level with an absolutedifference value exceeding the predetermined threshold value, determinesthat the input image is an image in which the area of regions of uniformcolor is large.

As described above, the image type determiner 2 calculates, for eachcolor component, from the input gray scale histogram, the absolutedifference values between the frequencies of adjacent classes in thegray scale histogram. Then, the image type determiner 2 compares thecalculated absolute difference values within ranges excluding themaximum classes and minimum classes with the predetermined thresholdvalue, and if there is an absolute difference value exceeding thethreshold value, determines that the input image is an image in whichthe area of regions of uniform color is large. That is, the image typedeterminer 2 determines that the ratio of the area of image regionswhere the gray scale components are uniform is greater than or equal toa predetermined threshold value. Finally, the image type determiner 2determines the image type of the image on the basis of the ratio of thearea of image regions where the gray scale components are uniform, andoutputs the determination result to the gray scale correction curvegenerator 4. The image type includes, for example, an image type inwhich the area of regions of uniform color is small, and an image typein which the area of regions of uniform color is large. The formerincludes a photographed image obtained by photographing an object. Thelatter includes a drawn image, such as a painting, a CG, or anillustration, obtained by designing colors and shapes by hand.

The maximum/minimum calculator 3 calculates, for each color component, amaximum and a minimum of the gray levels in the gray scale histogramoutput from the gray scale histogram calculator 1. FIG. 5 is an exampleof the gray scale histogram input to the maximum/minimum calculator 3.The operation of the maximum/minimum calculator 3 will be describedusing FIG. 5.

In FIG. 5, the horizontal axis represents the classes (gray levels) andthe vertical axis represents the frequency. The maximum/minimumcalculator 3 calculates, for each color component, a maximum class maxand a minimum class min of the gray scale histogram. The minimum classmin is the minimum of classes having a frequency greater than 0; themaximum class max is the maximum of the classes having a frequencygreater than 0.

The maximum of the gray scale histogram is not limited to the maximumclass max; it is possible to accumulate the frequencies from the maximumof the classes toward the minimum of the classes until the accumulatedfrequency exceeds A % (A is a predetermined percentage) of the totalnumber of pixels in the input image, and determine, as the maximumclass, the class maxA (denoted by max′ in FIG. 5) corresponding to thelast accumulated frequency. This makes it possible to accuratelycalculate the maximum of the gray scale histogram even if the inputimage signal includes noise. The value of A % may be set within a rangeof 1% to 5%, for example.

Similarly, it is possible to accumulate the frequencies from the minimumof the classes toward the maximum of the classes until the accumulatedfrequency exceeds a predetermined percentage (B %) of the total numberof pixels in the input image, and determine, as the minimum, the classminA (denoted by min′ in FIG. 5) corresponding to the last accumulatedfrequency. The greater the predetermined percentage (B %), the greaterthe slope of a gray scale correction curve, described later, andtherefore the higher the effect of improvement by the gray scalecorrection. When the predetermined percentage (B %) used in thecalculation of the minimum is less than the predetermined percentage (A%) used in the calculation of the maximum, a brighter output image canbe obtained.

The maximum/minimum calculator 3 receives the gray scale histograms forthe three color components of R, G, and B, and thus outputs, to the grayscale correction curve generator 4, a total of six values: the maximumof the R component, the minimum of the R component, the maximum of the Gcomponent, the minimum of the G component, the maximum of the Bcomponent, and the minimum of the B component.

The gray scale correction curve generator 4 generates a gray scalecorrection curve on the basis of the maximum and minimum of the classesof each color component input from the maximum/minimum calculator 3 andthe determination result of the image type of the input image input fromthe image type determiner 2.

If the image type input from the image type determiner 2 is an imagetype in which the area of regions of uniform color is small, the grayscale correction curve generator 4 uses the maximum and minimum of eachcolor component input from the maximum/minimum calculator 3 to generatea gray scale correction curve in the following procedure. If the imagetype input from the image type determiner 2 is an image type in whichthe area of regions of uniform color is large, the gray scale correctioncurve generator 4 generates, as described later, a gray scale correctioncurve that is a straight line with a slope of 1 and provides the grayscale of the output image signal equal to the gray scale of the inputimage signal.

First, the gray scale correction curve generator 4 calculates, as amaximum of gray levels of color signals, the largest of the maximum ofthe R component, the maximum of the G component, and the maximum of theB component input from the maximum/minimum calculator 3, and alsocalculates, as a minimum of the gray levels of the color signals, thesmallest of the minimum of the R component, the minimum of the Gcomponent, and the minimum of the B component input from themaximum/minimum calculator 3.

FIG. 6 shows an example of the gray scale correction curve generated bythe gray scale correction curve generator 4 in this embodiment. In FIG.6, the horizontal axis represents the gray level of the input imagesignal and the vertical axis represents the gray level of the outputimage signal. The polygonal line indicated by character a and the curveline indicated by character b in the drawing are respectively a firstgray scale correction curve and a second gray scale correction curve inthis embodiment, described later. Each of characters c and e in thedrawing indicates the minimum of the gray levels of the color signalscalculated by the gray scale correction curve generator 4; each ofcharacters d and f in the drawing indicates the maximum of the graylevels of the color signals calculated by the gray scale correctioncurve generator 4.

Here, c, d, e, and f are determined depending on the predeterminedpercentages A % and B % used in the calculation of the maximum graylevel and minimum gray level of the gray scale histogram in FIG. 5. Thegray level maxA at which the cumulative histogram reaches A % is d or f;the gray level minA at which the cumulative histogram reaches B % is cor e. When the predetermined percentage A % is small, the gray levelmaxA is d; when the predetermined percentage A % is large, the graylevel maxA is f. Similarly, When the predetermined percentage B % issmall, the gray level minA is c; when the predetermined percentage B %is large, the gray level minA is e. The straight line indicated bycharacter k in the drawing is a straight line with a slope of 1.

The first gray scale correction curve is generated by using the minimumc and maximum d of the gray levels of the color signals. When the graylevel of the input image signal is equal to or greater than 0 and lessthan c, the gray level of the output image signal is 0. When the graylevel of the input image signal is equal to or greater than c and lessthan d, the gray level xo of the output image signal corresponding tothe gray level xi of the input image signal is a value on a straightline represented by the following equation (1). When the gray level ofthe input image signal is equal to or greater than d and equal to orless than 255, the gray level of the output image signal is 255.xo=(d−c)/255×(xi−c)  (1)

The second gray scale correction curve is generated by using the minimume and maximum f of the gray levels of the color signals. When the graylevel of the input image signal is equal to or greater than 0 and lessthan c, the gray level of the output image signal is 0. When the graylevel of the input image signal is equal to or greater than d and equalto or less than 255, the gray level of the output image signal is 255.When the gray level of the input image signal is equal to or greaterthan c and less than d, a straight line represented by the followingequation (2) is first determined.xo=(f−e)/255×(xi−e)  (2)

Next, two points h and i on the straight line represented by theequation (2) are selected. For example, the point h is the point atwhich the gray level of the output image signal is 64, and the point iis the point at which the gray level of the output image signal is 192.However, this is not mandatory and it is sufficient that the points hand i are on the straight line represented by the equation (2). Thepoint at which the gray level of the input image signal is c and thegray level of the output image signal is 0 is denoted by g; the point atwhich the gray level of the input image signal is d and the gray levelof the output image signal is 255 is denoted by j; a curve smoothlyconnecting the four points g, h, i, and j is generated. The curve is,for example, a spline curve. When the gray level of the input imagesignal is equal to or greater than c and less than d, the gray level xoof the output image signal corresponding to the gray level xi of theinput image signal is a value on the curve obtained as above.

If the determination result input from the image type determiner 2indicates the image type in which the area of regions of uniform coloris small, the gray scale correction curve generator 4 selects, as afinal gray scale correction curve, one of the first gray scalecorrection curve and second gray scale correction curve. For example, ifthe following first to fourth conditions are all satisfied, the secondgray scale correction curve is selected as the final gray scalecorrection curve; otherwise, the first gray scale correction curve isselected as the final gray scale correction curve. The first conditionis that c is less than a first predetermined value; the second conditionis that (e−c) is equal to or greater than a second predetermined value;the third condition is that d is equal to or greater than a thirdpredetermined value; the fourth condition is that (f−d) is equal to orgreater than a fourth predetermined value. When c is small or d islarge, since the effect of gray scale correction is small, the secondgray scale correction curve, which has a steeper slope and provides ahigher effect of gray scale correction for intermediate gray levels, isdesirable. When (e−c) or (f−d) is large, since the second gray scalecorrection curve has a larger number of gray levels at which the effectof gray scale correction is low in high gray levels and low gray levelsthan the first gray scale correction curve, the first gray scalecorrection curve, which provides a higher effect of gray scalecorrection for high gray levels and low gray levels, is desirable.

The first, second, third, and fourth predetermined values may be set to16, 16, 224, and 32, respectively, for example.

On the other hand, if the determination result input from the image typedeterminer 2 indicates the image type in which the area of regions ofuniform color is large, the gray scale correction curve generator 4outputs, to the gray scale corrector 5, as the final gray scalecorrection curve, a gray scale correction curve that is the straightline indicated by k in FIG. 6, i.e., the straight line that has a slopeof 1 and provides the gray scale of the output image signal identical tothe gray scale of the input image signal.

Thus, the gray scale correction curve generator 4 outputs, as the finalgray scale correction curve, to the gray scale corrector 5, the grayscale correction curve that is the straight line with a slope of 1 ifthe determination result input from the image type determiner 2indicates the image type in which the area of regions of uniform coloris large, and one of the first gray scale correction curve and secondgray scale correction curve if the determination result input from theimage type determiner 2 indicates the image type in which the area ofregions of uniform color is small.

The gray scale corrector 5 converts, for each color component, the grayscale of the input image signal on the basis of the final gray scalecorrection curve input from the gray scale correction curve generator 4.

In the image processing device as configured in this manner, when thefinal gray scale correction curve input to the gray scale corrector 5 isthe first gray scale correction curve, the gray scale is converted bythe first gray scale correction curve. This provides an advantage ofincreasing the effect of gray scale correction for high gray levels andlow gray levels. When the final gray scale correction curve input to thegray scale corrector 5 is the second gray scale correction curve, thegray scale is converted by the second gray scale correction curve. Thisprovides an advantage of increasing the effect of gray scale correctionfor intermediate gray levels. When the final gray scale correction curveinput to the gray scale corrector 5 is the gray scale correction curvethat is the straight line with a slope of 1, the gray scale of theoutput image signal is the same as that of the input image signal. Thismakes it possible to prevent an image in which brightness change due togray scale correction is undesirable from being processed. When the grayscale correction curve is the straight line with a slope of 1, since thegray scale of the output image signal is the same as that of the inputimage signal, the processing of converting the gray scale may beomitted.

As such, the image type determiner, which detects whether the inputimage signal is an image, such as a cartoon, a CG, or a painting, inwhich the area of regions of uniform color is large and determines theimage type, is provided. This provides an advantage of maintaining thebrightness of an image in which brightness change due to gray scalecorrection is undesirable and increasing the effect of gray scalecorrection for an image that requires brightness change due to grayscale correction.

FIGS. 7(a) to 7(c) show an example of an image processed by the imageprocessing device in this embodiment. FIG. 7(a) is an input image; FIGS.7(b) and 7(c) are output images. FIG. 7(a) is an example of an image inwhich the area of regions of uniform color is large, and is anillustration of a koala bear having a body color of gray. If gray scalecorrection is performed on the input image by using, for example, theabove-described first gray scale correction curve without determiningthe image type as in the past, the gray scale correction changes thebody color of the koala bear to white as shown in FIG. 7(b). On theother hand, the image processing device in this embodiment determines,by the image type determiner 2, that the input image is an image inwhich the area of regions of uniform color is large, and performs grayscale correction on the input image by using, as the final gray scalecorrection curve, the gray scale correction curve that is the straightline with a slope of 1 (or performs no gray scale correctionprocessing). Thus, the body color of the koala bear can be maintainedgray in the output image as shown in FIG. 7(c).

For each of the gray scale histograms, the image processing deviceaccording to this embodiment accumulates the frequencies from themaximum toward the minimum of the gray levels and determines, as amaximum, the gray level at which the accumulated frequency first exceedsa value of predetermined proportion of the total number of pixels in theinput image signal. Thus, even if the input image signal includes noise,an accurate maximum of the gray levels can be calculated.

While in the past, a predetermined value is used as a threshold valueused in calculation of a maximum of gray levels, this embodiment uses apredetermined proportion of the size (the total number of pixels) of theinput image as the threshold value. This eliminates a problem that thethreshold value varies with image size and the result of the correctiondiffers between an enlarged image and a reduced image of the same image,for example.

A gray level lower than the maximum of the gray levels of the inputimage signal is calculated as a maximum. This increases the amount ofgray scale correction in extending a gray level distribution to the highgray level side, and enables conversion to a brighter image.

Further, for each of the gray scale histograms, the image processingdevice according to this embodiment accumulates the frequencies from theminimum toward the maximum of the gray levels and determines, as aminimum, the gray level at which the accumulated frequency first exceedsa value of predetermined proportion of the total number of pixels in theinput image signal. Thus, even if the input image signal includes noise,an accurate minimum of the gray level distribution can be calculated.

While in the past, a predetermined value is used as a threshold valueused in calculation of a minimum of gray levels, the present inventionuses a predetermined proportion of the size (the total number of pixels)of the input image as the threshold value. This eliminates a problemthat the threshold value varies and the correction result differsdepending on image size.

A gray level higher than the minimum of the gray levels of the inputimage signal is calculated as a minimum. This increases the amount ofgray scale correction in extending a gray level distribution to the lowgray level side, and enables conversion to an image having a highereffect of gray scale correction.

In this embodiment, the image type determiner 2 compares the absolutedifference values of the gray scale histograms with a predeterminedthreshold value, and if there is a gray level having an absolutedifference value exceeding the threshold value, determines that theinput image is an image in which the area of regions of uniform color islarge; but it may count the number of gray levels having an absolutedifference value exceeding a threshold value, and determine, accordingto whether the counted number exceeds a predetermined value, whether theinput image is an image in which the area of regions of uniform color islarge.

For example, the threshold value for the absolute difference values ofthe gray scale histograms is set to 20%. The image type determiner 2compares the absolute difference values of the gray scale histogram foreach of the color components of R, G, and B with the threshold value,and counts the number of gray levels having an absolute difference valueexceeding the threshold value. Then, if the counted number exceeds apredetermined value (e.g., 5), it may determine that the input image isan image in which the area of regions of uniform color is large. Such adetermination makes it possible to take advantage of the characteristicthat a drawn image, such as an illustration, has a small number ofcolors, making an accurate determination.

In this embodiment, the image type determiner 2 compares all of thefrequencies from the minimum class to the maximum class in the absolutedifference values of the gray scale histograms with the predeterminedthreshold value to determine whether the input image is an image inwhich the area of regions of uniform color is large; but it may comparethe frequencies within a range excluding the minimum class and themaximum class of the absolute difference values of the gray scalehistograms with the predetermined threshold value to determine whetherthe input image is an image in which the area of regions of uniformcolor is large.

This is because, even in an image in which the area of regions ofuniform color is small, a class having an extremely large absolutedifference value of a gray scale histogram may occur. This phenomenonoccurs at only one or both of the minimum class and the maximum class.By comparing the frequencies within the ranges excluding the minimumclasses and the maximum classes of the absolute difference values of thegray scale histograms with the predetermined threshold value, it becomespossible to correctly determine whether the input image is an image inwhich the area of regions of uniform color is large.

The image type determiner 2 may use only the gray scale histogram forthe green component to calculate the absolute difference values of thegray scale histogram, and compares all the frequencies of the absolutedifference values of the gray scale histogram with a predeterminedthreshold value to determine whether the input image is an image inwhich the area of regions of uniform color is large. This is because thephenomenon that an absolute difference value of a gray scale histogramis extremely large even in an image in which the area of regions ofuniform color is small may occur in the absolute difference values ofthe gray scale histograms for the red component and blue component, butdoes not occur in the absolute difference values of the gray scalehistogram for the green component, which is close to a luminancecomponent. Using only the gray scale histogram for the green componentmakes it possible to remove calculation, such as the calculation of theabsolute difference values and the comparison with the threshold value,required when the gray scale histograms for the other color componentsare also used, and correctly determine whether the input image is animage in which the area of regions of uniform color is large.

This embodiment describes a configuration in which the gray scalecorrection curve generator 4 selects the final gray scale correctioncurve from among the generated plurality of gray scale correction curvesand outputs the selected final gray scale correction curve to the grayscale corrector 5; but another configuration is possible in which thegray scale correction curve generator 4 outputs all of the generatedgray scale correction curves to the gray scale corrector 5 withoutselecting the final gray scale correction curve, and the gray scalecorrector 5 selects, from among the input gray scale correction curves,the final gray scale correction curve to use for the gray scalecorrection.

Second Embodiment

While the image type determiner 2 in the first embodiment determineswhether the input image is an image in which the area of regions ofuniform color is large or an image in which the area of regions ofuniform color is small to determine the image type of the input image,the second embodiment grades the image type of the input image on thebasis of the area of regions of uniform color.

The image processing device in this embodiment has the sameconfiguration as the image processing device in the first embodiment,and includes a gray scale histogram calculator, an image typedeterminer, a maximum/minimum calculator, a gray scale correction curvegenerator, and a gray scale corrector. This embodiment differs from thefirst embodiment in the method of determining the image type by theimage type determiner and the method of selecting the final gray scalecorrection curve by the gray scale correction curve generator.

The types of the input image will now be described. An image may not beable to be classified into either an image obtained by photographing anobject by an electronic device such as a digital camera, and an image,such as a painting, a CG, or an illustration, obtained by designingcolors and shapes by hand. For example, the former may be processed intoa painting-like image. The latter may be an image that is so close to aphotographed image that it cannot be distinguished from the former. Inorder to perform finely-tuned image processing on them, it is necessaryto calculate a degree indicating whether it is close to a photographedimage or a designed image to determine the image type and perform grayscale correction according to the determined image type.

The image type determiner uses the input gray scale histogram for eachcolor component to calculate histograms of the absolute differencevalues between the frequencies of adjacent classes in the gray scalehistograms, as in the first embodiment. Although the first embodimentsets a threshold value and if the histograms of the absolute differencevalues include an absolute difference value exceeding the thresholdvalue, determines that the input image is an image in which the area ofregions of uniform color is large, this embodiment uses a maximum of thehistograms of the absolute difference values to determine a degree ofsize of the area of regions of uniform color in the input image.

The larger the area of regions of uniform color in the input image, thegreater the maximum of the histograms of the absolute difference values.With this characteristic, the image type determiner determines a uniformlevel according to the maximum of the histograms of the absolutedifference values as follows: the uniform level is 0 if the maximum isless than 5%; the uniform level is 1 if the maximum is from 5% to 10%;the uniform level is 2 if the maximum is from 10% to 15%; the uniformlevel is 3 if the maximum is from 15% to 20%; the uniform level is 4 ifthe maximum is from 20% to 25%; and the uniform level is 5 if themaximum is equal to or greater than 25%. The image type determinerdetermines the degree of size of the area of regions of uniform color byusing the uniform level. According to this determination, the larger thearea of regions of uniform color in the input image, the greater thevalue of the uniform level.

Finally, the image type determiner outputs, as the determination resultof the image type, the determination result of the uniform level (one ofthe uniform levels of 0 to 5) to the gray scale correction curvegenerator.

Next, the operation of the gray scale correction curve generator in thisembodiment will be described. In the gray scale correction curvegenerator, the method of calculating a maximum and a minimum of graylevels by using the gray scale histogram for each color component inputfrom the gray scale histogram calculator in the maximum/minimumcalculator is the same as in the first embodiment.

FIG. 8 shows an example of the gray scale correction curve generated bythe gray scale correction curve generator in this embodiment. In FIG. 8,the horizontal axis represents the gray level of the input image signaland the vertical axis represents the gray level of the output imagesignal. Of the reference characters in the drawing, the referencecharacters a, d, g, j, and k, which are also shown in FIG. 6 used in thedescription of the first embodiment, indicate the same lines and pointsas those in FIG. 6. The polygonal line indicated by character a1 in thedrawing is a third gray scale correction curve used in this embodiment.

In FIG. 8, the point g1 in the drawing is a point that internallydivides the line segment connecting the point (origin) at which both ofthe gray levels of the input image signal and output image signal are 0and the point g, according to the uniform level input from the imagetype determiner. In this case, the internal division is performed insuch a manner that the point g1 approaches the point g as the uniformlevel becomes smaller. For example, when the uniform level of the inputimage is 3 of the five levels in total, the point g1 internally dividesthe line segment connecting the origin and the point g at a ratio of2:3.

Further, the point j1 in the drawing is a point that internally dividesthe line segment connecting the point j and the point (referred to belowas the maximum point) at which both of the gray levels of the inputimage signal and output image signal are 255, according to the uniformlevel input from the image type determiner. In this case, the internaldivision is performed in such a manner that the point j1 approaches thepoint j as the uniform level becomes smaller. For example, when theuniform level of the input image is 3 of the five levels in total, thepoint j1 internally divides the line segment connecting the point j andthe maximum point at a ratio of 3:2. A polygonal line connecting theorigin, point g1, point j1, and maximum point is determined as the thirdgray scale correction curve a1 in this embodiment. In this manner, thethird gray scale correction curve is generated.

FIG. 9 shows an example of another gray scale correction curve,differing from the third gray scale correction curve, generated by thegray scale correction curve generator in this embodiment. In FIG. 9, thehorizontal axis represents the gray level of the input image signal andthe vertical axis represents the gray level of the output image signal.Of the reference characters in the drawing, the reference characters a,d, g, j, and k, which are also shown in FIG. 6 used in the descriptionof the first embodiment, indicate the same lines and points as those inFIG. 6. The polygonal line indicated by character a2 in the drawing is afourth gray scale correction curve used in this embodiment. The grayscale correction curve is the same as the third gray scale correctioncurve described in FIG. 8 in that the gray scale correction curve isgenerated on the basis of the uniform level input from the image typedeterminer, but it is generated using points differing from those forthe third gray scale correction curve.

In FIG. 9, the point j3 in the drawing is a point on the straight line kand has the same gray level of the input image signal as the point d.The point g3 is a point on the straight line k and has the gray level ofthe input image signal at the point g. The point j2 is a point thatinternally divides the line segment connecting the points j and j3; thepoint g2 is a point that internally divides the line segment connectingthe points g and g3. In this case, the internal divisions are performedin such a manner that the points j2 and g2 approach the points j and gas the uniform level becomes smaller. For example, when the uniformlevel is 3 of the five levels in total, the point j2 internally dividesthe line segment connecting the points j and j3 at a ratio of 3:2, andthe point g2 internally divides the line segment connecting the points gand g3 at a ratio of 3:2. A polygonal line connecting the origin, pointg2, point j2, and maximum point is determined as the fourth gray scalecorrection curve a2 in this embodiment. In this manner, the fourth grayscale correction curve is generated.

Even when one of the third gray scale correction curve and fourth grayscale correction curve is generated, if the uniform level input from theimage type determiner is 0, the polygonal line indicated by a in FIGS. 8and 9 is determined as the gray scale correction curve, and if theuniform level input from the image type determiner is 5, the straightline indicated by k in FIGS. 8 and 9 is determined as the gray scalecorrection curve.

The difference in the effect of gray scale correction between the thirdgray scale correction curve and the fourth gray scale correction curvewill be described. Since the third gray scale correction curve has alarger slope in high gray levels and low gray levels than that of thefourth gray scale correction curve, it can provide a higher effect ofgray scale correction for high gray levels and low gray levels. Sincethe fourth gray scale correction curve has a larger slope inintermediate gray levels than that of the third gray scale correctioncurve, it can provide a higher effect of gray scale correction forintermediate gray levels.

Finally, the gray scale correction curve generator selects, as a finalgray scale correction curve, one of the third gray scale correctioncurve and fourth gray scale correction curve generated according to theuniform level, which is the determination result of the image type, andoutputs the final gray scale correction curve to the gray scalecorrector. An example of the method of selecting one of the third andfourth gray scale correction curves selects the fourth gray scalecorrection curve if the slope of the polygonal line of the third grayscale correction curve is below, for example, 1.15. This is because,when the slope of the polygonal line of the third gray scale correctioncurve is below 1.15, the effect of gray scale correction of an imagewith the third gray scale correction curve is smaller than that with thefourth gray scale correction curve.

The gray scale corrector converts, for each color component, the grayscale of the input image signal on the basis of the final gray scalecorrection curve input from the gray scale correction curve generator.When the input final gray scale correction curve is the third gray scalecorrection curve, the gray scale is converted with the third gray scalecorrection curve. This provides an advantage of increasing the effect ofgray scale correction for high gray levels and low gray levels. When theinput final gray scale correction curve is the fourth gray scalecorrection curve, the gray scale is converted with the fourth gray scalecorrection curve. This provides an advantage of increasing the effect ofgray scale correction for intermediate gray levels.

Even when the input final gray scale correction curve is one of thethird gray scale correction curve and fourth gray scale correctioncurve, if the uniform level determined by the image type determiner is5, since it is the gray scale correction curve that is the straight linewith a slope of 1, the gray scale of the output image signal is madeidentical to the gray scale of the input image signal. This makes itpossible to prevent an image in which brightness change due to grayscale correction is undesirable from being processed, as in the firstembodiment. When the uniform level is 5, since the gray scale of theoutput image signal is the same as that of the input image signal, theprocessing of converting the gray scale may be omitted.

The image processing device as configured in this manner includes theimage type determiner that determines the image type according to thearea of regions of uniform color in the input image signal. Thisprovides an advantage of maintaining the brightness of an image in whichbrightness change due to gray scale correction is undesirable andincreasing the effect of gray scale correction for an image thatrequires brightness change due to gray scale correction, according tothe area of regions of uniform color.

Third Embodiment

While in the second embodiment, when the image type determiner gradesthe image type of the input image on the basis of the area of regions ofuniform color, it determines a degree of size of the area of regions ofuniform color in the input image by using the maximum of the histogramsof the absolute difference values, the third embodiment determines adegree of size of the area of regions of uniform color according to thenumber of gray levels at which a predetermined threshold value isexceeded in the histograms of the absolute difference values.

The image processing device in this embodiment has the sameconfiguration as the image processing device in the first embodiment,and includes a gray scale histogram calculator, an image typedeterminer, a maximum/minimum calculator, a gray scale correction curvegenerator, and a gray scale corrector. The image type determiner in thisembodiment determines the image type by a method different from those inthe first and second embodiments.

The image type determiner uses the input gray scale histogram for eachcolor component to calculate histograms of the absolute differencevalues between the frequencies of adjacent gray levels in the gray scalehistograms, as in the first embodiment. This embodiment sets apredetermined threshold value for the histograms of the absolutedifference values, and counts the number of gray levels at which thethreshold value is exceeded in the histograms of the absolute differencevalues to determine a degree of size of the area of regions of uniformcolor in the input image.

When there are many solid portions with different colors, the histogramsof the absolute difference values include many steep peaks. With thischaracteristic, the image type determiner sets a threshold value, e.g.,20%, and determines a uniform level according to the number of graylevels at which the threshold value is exceeded in the histograms of theabsolute difference values as follows: the uniform level is 0 if thenumber of gray levels is 0; the uniform level is 1 if the number of graylevels is 1 or 2; the uniform level is 2 if the number of gray levels is3 or 4; the uniform level is 3 if the number of gray levels is 5 to 8;the uniform level is 4 if the number of gray levels is 9 to 16; and theuniform level is 5 if the number of gray levels is 17 or greater. Theimage type determiner determines the degree of size of the area ofregions of uniform color by using the uniform level. According to thisdetermination, the more solid portions with different colors, that is,the larger the area of regions of uniform color in the input image, thegreater the value of the uniform level.

Finally, the image type determiner outputs, as the determination resultof the image type, the determination result of the uniform level (one ofthe uniform levels of 0 to 5) to the gray scale correction curvegenerator.

As in the second embodiment, the gray scale correction curve generatorgenerates a third gray scale correction curve and fourth gray scalecorrection curve on the basis of the uniform level input from the imagetype determiner, determines a final gray scale correction curve on thebasis of the uniform level input from the image type determiner, andoutputs the final gray scale correction curve to the gray scalecorrector.

The gray scale corrector converts, for each color component, the grayscale of the input image signal on the basis of the final gray scalecorrection curve input from the gray scale correction curve generator,as in the second embodiment.

The image processing device as configured in this manner includes theimage type determiner that determines the image type according to thearea of regions of uniform color in the input image signal. Thisprovides an advantage of maintaining the brightness of an image in whichbrightness change due to gray scale correction is undesirable andincreasing the effect of gray scale correction for an image thatrequires brightness change due to gray scale correction, according tothe area of regions of uniform color.

In the second and third embodiments, the uniform level is rated on afive-step scale of 1 to 5 to determine the degree of size of the area ofregions of uniform color; but the number of steps of the uniform levelis not limited to this and arbitrary.

The first to third embodiments describe R, G, and B as the colorcomponents; but the color components are not limited to this and may beC, M, Y, and K used in printing machines or the like. They also may beHSV or YCbCr; in this case, the gray scale correction curve generatorneeds to generate the gray scale correction curve so that the gray scalecorrection causes no change in the color. For example, in the case ofHSV, it is desirable to generate gray scale correction curves for S andV to convert an image signal without changing H. In the case of YCbCr,since the relation between Cb and hue and the relation between Cr andhue are complicated, it is desirable to convert them into R, G, and Band then apply processing in which the ratio between R, G, and B is notchanged before and after the gray scale correction.

Fourth Embodiment

In the first embodiment, the maximum/minimum calculator 3 calculates amaximum of a gray scale histogram from a frequency obtained byaccumulating the gray scale histogram from the maximum toward theminimum of the classes, and calculates a minimum of a gray scalehistogram from a frequency obtained by accumulating the gray scalehistogram from the minimum toward the maximum of the classes. The fourthembodiment calculates a maximum of a gray scale histogram from afrequency obtained by accumulating the gray scale histogram from themaximum toward the minimum of the classes and the absolute differencevalues of the gray scale histogram, and calculates a minimum of the grayscale histogram from a frequency obtained by accumulating the gray scalehistogram from the minimum toward the maximum of the classes and theabsolute difference values of the gray scale histogram.

The image processing device in this embodiment has the sameconfiguration as the image processing device in the first embodiment,and includes a gray scale histogram calculator, an image typedeterminer, a maximum/minimum calculator, a gray scale correction curvegenerator, and a gray scale corrector. The maximum/minimum calculator inthis embodiment calculates the maximum and minimum by a method differentfrom that in the first embodiment.

The operation of the maximum/minimum calculator in this embodiment willbe described. The maximum/minimum calculator receives the gray scalehistogram for each color component from the gray scale histogramcalculator. The maximum/minimum calculator calculates, for each colorcomponent, a maximum and a minimum in the gray scale histogram andoutputs them to the gray scale correction curve generator.

A method of calculating a maximum and a minimum in a gray scalehistogram will be described using FIGS. 10(a) and 10(b). FIG. 10(a)shows an example of the gray scale histogram of the R component,assuming that the color components of the input image signal consist ofR, G, and B, and the gray scale components have 256 gray levels rangingfrom 0 to 255. FIG. 10(a) is a gray scale histogram having a horizontalaxis representing gray levels and a vertical axis representing theproportion (frequency) of pixels to the total number of pixels in theinput image. While in general, a histogram is a distribution having ahorizontal axis representing classes and a vertical axis representingfrequency, in this embodiment, the class interval is equal to the graylevel interval and thus the values of the classes are equal to thevalues of the gray levels.

As in the first embodiment, first, the maximum/minimum calculatoraccumulates the frequencies of the gray scale histogram from the maximumtoward the minimum of the gray levels and obtains the gray level maxA atwhich the accumulated frequency first exceeds A % (A is a predeterminedvalue) of the total number of pixels in the input image. In thisembodiment, the gray level maxA is obtained as a first candidatemaximum. Then, it accumulates the frequencies of the gray scalehistogram from the minimum toward the maximum of the gray levels andobtains the gray level minA at which the accumulated frequency firstexceeds B % (B is a predetermined value) of the total number of pixelsin the input image. In this embodiment, the gray level minA is obtainedas a first candidate minimum.

The first embodiment determines, as a maximum of the gray scalehistogram, instead of the maximum gray level, the gray level at which avalue obtained by accumulating the gray scale histogram from the maximumgray level reaches the percentage A % of all the pixels. This aims toaccurately calculate a maximum of the gray scale histogram even if theinput image signal includes noise. The first embodiment also determines,as a minimum of the gray scale histogram, instead of the minimum graylevel, the gray level at which a value obtained by accumulating the grayscale histogram from the minimum gray level reaches the percentage B %of all the pixels. This aims to accurately calculate a minimum of thegray scale histogram even if the input image signal includes noise.

Since A % and B % are fixed values, the method of the first embodimentregards, as noise, gray levels within a range from the maximum graylevel to the gray level of A % and from the minimum gray level to thegray level of B % with respect to all the pixels, regardless of theshape of the gray scale histogram. However, depending on the image, therange to the gray level of A % and the range to the gray level of B %may include a gray level that is not noise but important. If animportant gray level is regarded as noise, since the gray scalecorrector following the maximum/minimum calculator performs processingto reduce gray level difference with respect to gray levels from themaximum of the gray scale histogram to 255 and from 0 to the minimum ofthe gray scale histogram, a defect of loss of gradation may be caused.

Thus, this embodiment calculates the maximum and minimum by takingadvantage of characteristics of noise in the shape of the gray scalehistogram. The characteristics of noise of the gray scale histograminclude the following: a first characteristic that the proportionrelative to all the pixels is small; and a second characteristic that asharp change (increase or decrease) at a particular gray level does notoccur. The first candidate maximum and first candidate minimum are anexample that takes advantage of the first characteristic. They takeadvantage of the fact that the proportion relative to all the pixels issmall and therefore the accumulated value is also small. Following thecalculation of the first candidate maximum and first candidate minimum,the maximum/minimum calculator calculates a second candidate maximum anda second candidate minimum by taking advantage of the secondcharacteristic.

FIG. 10(b) shows the histogram of the absolute difference values betweenthe frequencies of adjacent gray levels in the gray scale histogram ofthe R component in FIG. 10(a). In FIG. 10(b), the horizontal axisrepresents the gray levels and the vertical axis represents the absolutedifference value (%). The absolute difference values indicate variationin the gray scale histogram. In gray levels of only noise, a gray leveldoes not increase sharply; that is, a gray level at which the gray scalehistogram changes sharply is a gray level with other than noise. Theabsolute difference values are compared with a predetermined thresholdvalue C; the minimum gray level minB of the gray levels having anabsolute difference value exceeding the threshold value C is determinedas the second candidate minimum; the maximum gray level maxB of the graylevels having an absolute difference value exceeding the threshold valueC is determined as the second candidate maximum. The threshold value Cis, for example, 0.1.

Finally, the first candidate minimum and the second candidate minimumare compared with each other, and the smaller is determined as theminimum of the gray scale histogram. The first candidate maximum and thesecond candidate maximum are compared with each other, and the larger isdetermined as the maximum of the gray scale histogram. In the case ofFIGS. 10(a) and 10(b), the maximum of the gray scale histogram is maxA,and the minimum of the gray scale histogram is minB.

The image processing device as configured in this manner calculates themaximum and minimum of the gray scale histogram by taking advantage ofcharacteristics of noise in the shape of the gray scale histogram. Thisprovides an advantage of being able to accurately calculate the maximumand minimum of important gray levels other than noise.

Further, the larger the maximum of the gray scale histogram, the largerthe effect of the gray scale correction of the present invention. Thesmaller the minimum of the gray scale histogram, the larger the effectof the gray scale correction of the present invention. In the firstembodiment, the larger the values of both A % and B %, the larger themaximum of the gray scale histogram and the smaller the minimum of thegray scale histogram. However, the larger the values of A % and B %, themore likely an important gray level is to be regarded as noise, the morelikely the gray scale correction of the present invention is to causeloss of gradation. However, since this embodiment calculates the maximumand minimum by taking advantage of the characteristics of noise, it canaccurately calculate the maximum and minimum of the gray scale histogramand maximize the effect of the gray scale correction of the presentinvention.

This embodiment compares the absolute difference values of the grayscale histogram with the threshold value to calculate a candidatemaximum and a candidate minimum; but a method of calculating a candidatemaximum and a candidate minimum is not limited to this and it issufficient that they are obtained by taking advantage of characteristicsof noise of the gray scale histogram. For example, taking advantage ofthe characteristic that the proportion to all the pixels is small, anexample compares the frequencies in the gray scale histogram with apredetermined threshold value to determine the minimum gray level of thegray levels having a frequency exceeding the predetermined thresholdvalue as a candidate minimum and the maximum gray level of the graylevels having a frequency exceeding the predetermined threshold value asa candidate maximum. The predetermined threshold value is, for example,a sufficiently small value such as 0.1.

With the characteristic that a sharp change at a particular gray leveldoes not occur, difference values of the gray scale histogram iscompared with a predetermined threshold value. A difference value of thegray scale histogram indicates a slope of the gray scale histogram andthus may be a negative value. The minimum gray level of gray levels atwhich the difference value of the gray scale histogram sharply increasesis determined as a candidate minimum. It is obtained by comparing thedifference values of the gray scale histogram with a predeterminedpositive threshold value to calculate the minimum gray level of the graylevels having a difference value exceeding the predetermined thresholdvalue. The maximum gray level of gray levels at which the differencevalue of the gray scale histogram sharply decreases is determined as acandidate maximum. It is obtained by comparing the difference values ofthe gray scale histogram with a predetermined negative threshold valueto calculate the maximum gray level of the gray levels having adifference value below the predetermined negative threshold value. Thepredetermined positive threshold value is 0.1, and the predeterminednegative threshold value is −0.1, for example.

REFERENCE CHARACTERS

1 gray scale histogram calculator, 2 image type determiner, 3maximum/minimum calculator, 4 gray scale correction curve generator, 5gray scale corrector.

What is claimed is:
 1. An image processing device comprising: a grayscale histogram calculator that calculates, with respect to an imagesignal having color components and gray scale components and forming animage, a gray scale histogram of the gray scale components for eachcolor component, each gray scale histogram having classes each having afrequency; a maximum/minimum calculator that uses the gray scalehistogram for each color component to calculate, for each colorcomponent, a maximum and a minimum of classes having a frequency greaterthan zero in the gray scale histogram; an image type determiner thatgenerates, for each color component, an absolute difference valuehistogram having classes each having an absolute difference valuebetween the frequencies of adjacent classes in the gray scale histogram,compares the absolute difference values in the absolute difference valuehistograms with a predetermined threshold value to determine, accordingto the presence or absence of an absolute difference value exceeding thethreshold value, a size of an area of image regions where the gray scalecomponents are uniform, and determines an image type of the imageaccording to the determination; a gray scale correction curve generatorthat generates a gray scale correction curve for correcting a gray scaleof the image signal for each color component, on a basis of a largestand a smallest of the maximum and the minimum of the classes for eachcolor component calculated by the maximum/minimum calculator and thedetermination of the image type; and a gray scale corrector that usesthe gray scale correction curve to perform gray scale correction on thegray scale components of the image signal for each color component,wherein for each color component, the maximum/minimum calculator:calculates, as a first maximum, a class at which an accumulated valueexceeds a predetermined proportion of a total frequency of the grayscale histogram, the accumulated value being obtained by accumulatingthe frequencies from a maximum class toward a minimum class in the grayscale histogram; calculates, as a first minimum, a class at which anaccumulated value exceeds a predetermined proportion of the totalfrequency of the gray scale histogram, the accumulated value beingobtained by accumulating the frequencies from the minimum class towardthe maximum class in the gray scale histogram; compares the absolutedifference values in the absolute difference value histogram with apredetermined threshold value to obtain a minimum of classes having anabsolute difference value exceeding the threshold value as a secondminimum and a maximum of the classes having an absolute difference valueexceeding the threshold value as a second maximum; determines, as theminimum of the classes, a smaller of the first minimum and the secondminimum; and determines, as the maximum of the classes, a larger of thefirst maximum and the second maximum.
 2. The image processing device ofclaim 1, wherein the gray scale correction curve generator generates thegray scale correction curve so that, for each color component, thelargest corresponds to a maximum of gray levels of the image signalafter the gray scale correction and the smallest corresponds to aminimum of the gray levels of the image signal after the gray scalecorrection.
 3. The image processing device of claim 1, wherein the imagetype determiner determines whether there is, in the absolute differencevalue histograms, a class having an absolute difference value exceedinga predetermined proportion of the total frequency of the gray scalehistogram, and if there is a class having an absolute difference valueexceeding the predetermined proportion, determines that the image typeis one in which an area of image regions where the gray scale componentsare uniform is larger than or equal to a predetermined proportion. 4.The image processing device of claim 3, wherein the image typedeterminer uses the absolute difference value histograms excludingminimum classes and maximum classes.
 5. The image processing device ofclaim 3, wherein the color components include a green component, and theimage type determiner uses the gray scale histogram for the greencomponent of the gray scale histograms for the color components.
 6. Theimage processing device of claim 3, wherein: the gray scale correctioncurve generator generates a plurality of gray scale correction curves ona basis of the maximum and the minimum of the classes for each colorcomponent; and the gray scale correction curve generator or the grayscale corrector selects one of the generated plurality of gray scalecorrection curves as the gray scale correction curve to be used in thegray scale correction.
 7. The image processing device of claim 1,wherein the image type determiner obtains a maximum of the absolutedifference values in the absolute difference value histograms, anddetermines, according to the obtained maximum, the image type of theimage.
 8. The image processing device of claim 7, wherein the image typedeterminer uses the absolute difference value histograms excludingminimum classes and maximum classes.
 9. The image processing device ofclaim 7, wherein the color components include a green component, and theimage type determiner uses the gray scale histogram for the greencomponent of the gray scale histograms for the color components.
 10. Theimage processing device of claim 7, wherein: the gray scale correctioncurve generator generates a plurality of gray scale correction curves ona basis of the maximum and the minimum of the classes for each colorcomponent; and the gray scale correction curve generator or the grayscale corrector selects one of the generated plurality of gray scalecorrection curves as the gray scale correction curve to be used in thegray scale correction.
 11. The image processing device of claim 1,wherein the image type determiner obtains the number of classes havingan absolute difference value exceeding a predetermined threshold valuein the absolute difference value histograms, and determines the imagetype of the image according to the obtained number of classes having anabsolute difference value exceeding the predetermined threshold value.12. The image processing device of claim 11, wherein the image typedeterminer uses the absolute difference value histograms excludingminimum classes and maximum classes.
 13. The image processing device ofclaim 11, wherein the color components include a green component, andthe image type determiner uses the gray scale histogram for the greencomponent of the gray scale histograms for the color components.
 14. Theimage processing device of claim 11, wherein: the gray scale correctioncurve generator generates a plurality of gray scale correction curves ona basis of the maximum and the minimum of the classes for each colorcomponent; and the gray scale correction curve generator or the grayscale corrector selects one of the generated plurality of gray scalecorrection curves as the gray scale correction curve to be used in thegray scale correction.
 15. The image processing device of claim 1,wherein the image type determiner uses the absolute difference valuehistograms excluding minimum classes and maximum classes.
 16. The imageprocessing device of claim 15, wherein: the gray scale correction curvegenerator generates a plurality of gray scale correction curves on abasis of the maximum and the minimum of the classes for each colorcomponent; and the gray scale correction curve generator or the grayscale corrector selects one of the generated plurality of gray scalecorrection curves as the gray scale correction curve to be used in thegray scale correction.
 17. The image processing device of claim 1,wherein the color components include a green component, and the imagetype determiner uses only the gray scale histogram for the greencomponent of the gray scale histograms for the color components.
 18. Theimage processing device of claim 17, wherein: the gray scale correctioncurve generator generates a plurality of gray scale correction curves ona basis of the maximum and the minimum of the classes for each colorcomponent; and the gray scale correction curve generator or the grayscale corrector selects one of the generated plurality of gray scalecorrection curves as the gray scale correction curve to be used in thegray scale correction.
 19. The image processing device of claim 1,wherein: the gray scale correction curve generator generates a pluralityof gray scale correction curves on a basis of the maximum and theminimum of the classes for each color component; and the gray scalecorrection curve generator or the gray scale corrector selects one ofthe generated plurality of gray scale correction curves as the grayscale correction curve to be used in the gray scale correction.
 20. Animage processing method comprising: calculating, using a gray scalehistogram calculator, with respect to an image signal having colorcomponents and gray scale components and forming an image, a gray scalehistogram of the gray scale components for each color component, eachgray scale histogram having classes each having a frequency; using thegray scale histogram for each color component to calculate, using amaximum/minimum calculator, for each color component, a maximum and aminimum of classes having a frequency greater than zero in the grayscale histogram; generating, using an image type determiner, for eachcolor component, an absolute difference value histogram having classeseach having an absolute difference value between the frequencies ofadjacent classes in the gray scale histogram, comparing the absolutedifference values in the absolute difference value histograms with apredetermined threshold value to determine, according to the presence orabsence of an absolute difference value exceeding the threshold value, asize of an area of image regions where the gray scale components areuniform, and determining an image type of the image according to thedetermination; generating, using a gray scale correction curvegenerator, a gray scale correction curve for correcting a gray scale ofthe image signal for each color component, on a basis of a largest and asmallest of the maximum and the minimum of the classes for each colorcomponent and the determination of the image type; and using the grayscale correction curve to perform, using a gray scale corrector, grayscale correction on the gray scale components of the image signal foreach color component, wherein for each color component, the calculationof the maximum and the minimum includes: calculating, as a firstmaximum, a class at which an accumulated value exceeds a predeterminedproportion of a total frequency of the gray scale histogram, theaccumulated value being obtained by accumulating the frequencies from amaximum class toward a minimum class in the gray scale histogram;calculating, as a first minimum, a class at which an accumulated valueexceeds a predetermined proportion of the total frequency of the grayscale histogram, the accumulated value being obtained by accumulatingthe frequencies from the minimum class toward the maximum class in thegray scale histogram; comparing the absolute difference values in theabsolute difference value histogram with a predetermined threshold valueto obtain a minimum of classes having an absolute difference valueexceeding the threshold value as a second minimum and a maximum of theclasses having an absolute difference value exceeding the thresholdvalue as a second maximum; determining, as the minimum of the classes, asmaller of the first minimum and the second minimum; and determining, asthe maximum of the classes, a larger of the first maximum and the secondmaximum.